package org.fhm.zdte.common.task;

import org.fhm.substrate.annotation.Setup;
import org.fhm.zdte.common.pojo.Address;
import org.fhm.zdte.common.protocol.AbstractMessageMonitor;
import org.fhm.zdte.common.protocol.AbstractMessageParser;
import org.fhm.zdte.common.protocol.AbstractMessageWrappers;

/**
 * The abstract layer for distribute a task.
 *
 * @author 谭波
 * @since 2023/10/31
 */
public abstract class AbstractDistributorTask extends AbstractTask {

    @Setup
    protected AbstractMessageMonitor abstractMessageMonitor;

    @Setup("->protocol.name")
    protected AbstractMessageParser abstractMessageParser;

    @Setup("->protocol.name")
    protected AbstractMessageWrappers abstractMessageWrappers;

    @Setup
    protected ReceiveDealTask receiveDealTask;

    /**
     * Obtain a task type and submit.
     *
     * @param buffer  Packet-Data.
     * @param address The source address of the Packet-Data.
     */
    public abstract void getTaskAndSubmit(byte[] buffer, Address address);

}
